 //
//  Frame.swift
//  TJShopSDK
//
//  Created by 庞成龙 on 2022/4/6.
//

import Foundation

private let screenBounds = UIScreen.main.bounds

private let screenWidth = (screenBounds.width < screenBounds.height) ? screenBounds.width : screenBounds.height

/// 以iPhone X的宽度为中间值，计算最合适的缩放比例
private let pixelScale = screenWidth / 375

internal extension FixedWidthInteger {
    /// 以iPhone X分辨率为基础，根据当前屏幕缩放系数，计算最合适的大小
    var scaled: CGFloat {
        return (CGFloat(self) * pixelScale)//.rounded()
    }
}

internal extension Float {
    /// 以iPhone X分辨率为基础，根据当前屏幕缩放系数，计算最合适的大小
    var scaled: CGFloat {
        return (CGFloat(self) * pixelScale)//.rounded()
    }
}

internal extension Double {
    /// 以iPhone X分辨率为基础，根据当前屏幕缩放系数，计算最合适的大小
    var scaled: CGFloat {
        return (CGFloat(self) * pixelScale)//.rounded()
    }
}

internal extension CGFloat {
    /// 以iPhone X分辨率为基础，根据当前屏幕缩放系数，计算最合适的大小
     var scaled: CGFloat {
        return (self * pixelScale)//.rounded()
    }
}

